package hu.ikti.oamadmin.types.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "REPOSITORY")
@SequenceGenerator(sequenceName = "REPOSITORY_SEQ", name = "REPO_SEQ", allocationSize = 1)
public class Repository {

	private Long id;
	private String name;
	private String description;
	private String url;
	private Date lastSync;

	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "REPO_SEQ")
	public Long getId() {
		return id;
	}

	@Column(name = "REPOSITORY_NAME", nullable = false)
	public String getName() {
		return name;
	}

	@Column(name = "DESCRIPTION", nullable = true)
	public String getDescription() {
		return description;
	}

	@Column(name = "URL", nullable = false, unique = true)
	public String getUrl() {
		return url;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "LAST_SYNC", nullable = false)
	public Date getLastSync() {
		return lastSync;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setLastSync(Date lastSync) {
		this.lastSync = lastSync;
	}

}
